<template>
  <f7-page @page:reinit="getDataItems">
    <f7-navbar title="吉林动画学院用人申请表" back-link="Back"></f7-navbar>
    <f7-list inline-labels no-hairlines-md >
      <f7-list-item>
        <f7-label>名称</f7-label>
        <f7-input type="text" :value="formContent.title" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>创建时间</f7-label>
        <f7-input type="text" :value="formContent.creationDate" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item  >
        <f7-label>申请部门</f7-label>
        <f7-input type="text"   :value="formContent.orgName" :disabled="true"> </f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>申请事由</f7-label>
        <f7-input type="select"  :value="formContent.reason"  :disabled="true">
          <option v-for="(value, index) in resonNum" v-bind:key="index" v-bind:value="index">{{value}}</option>
        </f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>职位名称</f7-label>
        <f7-input type="text" :value="formContent.positionName" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item  >
        <f7-label>拟招聘人数</f7-label>
        <f7-input  type="tel" placeholder="" clear-button :value="formContent.recruitCount"  :disabled="true" ></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>定编人数</f7-label>
        <f7-input type="tel" clear-button :value="formContent.allocationCount" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>现有人数</f7-label>
        <f7-input type="tel"  clear-button :value="formContent.existCount"  :disabled="true"></f7-input>
      </f7-list-item>

      <f7-list-item >
        <f7-label>核心职责</f7-label>
        <f7-input type="textarea" placeholder="Input here please" :value="formContent.coreRecruit"
                  @input="formContent.coreRecruit = $event.target.value"></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>常规职责</f7-label>
        <f7-input type="textarea"  :value="formContent.commonRecruit" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>任职基本条件</f7-label>
        <f7-input type="textarea"  :value="formContent.baseCondition" :disabled="true"></f7-input>
      </f7-list-item>


      <f7-list-item>
        <f7-label>待遇标准</f7-label>
        <f7-input type="text" :value="formContent.treatmentLevel" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>建议招聘方式</f7-label>
        <f7-input type="select" :value="formContent.recruitType" :disabled="true">
          <option v-for="(value, index) in recruitChannelNum" v-bind:key="index" v-bind:value="index">{{value}}</option>
        </f7-input>
      </f7-list-item>

      <f7-list-item >
        <f7-label>申请人</f7-label>
        <f7-input type="text"  :value="formContent.createBy" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>部门负责人</f7-label>
        <f7-input type="text"  :value="formContent.depUser" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>人力资源部长</f7-label>
        <f7-input type="text"  :value="formContent.manpower" :disabled="true"></f7-input>
      </f7-list-item>

    </f7-list>

    <f7-list accordion  >
      <f7-list-item title="流程历史" v-bind:link="'/oa/activities/' + formContent.processInstanceId"></f7-list-item>
      <f7-list-item title="附件数据" v-bind:link="'/oa/attachments/' + formContent.id"></f7-list-item>
      <!--<f7-list-item title="业务审批" link="#" @click="popupOpened = true"></f7-list-item>-->
      <f7-list-item accordion-item  id="m2" :accordion-item-opened="true"  title="业务审批" v-show="paramsId ==-1 ? false : true">
        <f7-accordion-content>
          <f7-block>
            <f7-list inline-labels no-hairlines-md>
              <f7-list-item>
                <f7-input type="textarea" placeholder="请在这里填写批注"  v-bind:value="admitData.comment"   @input="admitData.comment =  $event.target.value"></f7-input>
              </f7-list-item>
              <f7-list-item>
                <img slot="media" v-bind:src="admitData.signature" />
              </f7-list-item>
            </f7-list>
            <f7-button raised href="/oa/personalwork/signature" >手写签名</f7-button>
            <f7-block strong>
              <f7-row>
                <f7-col width="50">
                  <f7-button fill raised @click="superiorDecision('同意')">同意</f7-button>
                </f7-col>
                <f7-col width="50">
                  <f7-button fill raised color="red" @click="superiorDecision('不同意')">不同意</f7-button>
                </f7-col>
              </f7-row>
            </f7-block>
          </f7-block>
        </f7-accordion-content>
      </f7-list-item>
    </f7-list>

  </f7-page>
</template>

<script>
    export default {
      name: "admitRecruit",
      data() {
        return {
          paramsEntityId: this.$f7route.params.entityId,
          paramsId: this.$f7route.params.id,
          resonNum: this.GLOBAL.resonNum,
          recruitChannelNum: this.GLOBAL.recruitChannelNum,

          formContent: { },
          admitData: {
            signature: "",
            accepted: "不同意",
            comment: "",
            taskId: 0,
          },
        }
      },
      mounted() {
        this.$f7ready((f7) => {
          let that = this;
          f7.request.setup({
            headers: {
              'AccessToken': sessionStorage.getItem('accessToken'),
              'JSESSIONID': sessionStorage.getItem('userToken'),
            }
          });
            f7.request.json(that.GLOBAL.RequestAddress + '/camel/rest/recruitapplys/' +  that.paramsEntityId, { }, function (result) {
              that.formContent = result;
            });

        });
      },
      methods: {
        getDataItems: function () {
          let that = this;
          let app = that.$f7;
          let url = that.GLOBAL.RequestAddress + '/camel/rest/recruitapplys/' + that.paramsEntityId;
          app.request.json(url, {}, function (result) {
            that.formContent = result;
          })
          that.showSignaure();
        },
        superiorDecision: function (opinion) {
          let that = this;

          // let app = that.$f7;
          // let url = that.GLOBAL.RequestAddress + "/camel/rest/recruitapplys/workflow/completeTask"
          // that.admitData.taskId = that.paramsId;
          // that.admitData.accepted = opinion;
          // app.request.json(url, that.admitData, function (result) {
          //   that.showAlert("提示", result.msg);
          // })
        },
        showAlert: function (title, text) {
          let that = this;
          let app = that.$f7
          app.dialog.alert(text, title, () => {
            that.$f7router.back();
          });
        },
        showSignaure : function () {
          let that = this;
          that.signature = that.$f7.data.admitSig;
          that.$f7.data.admitSig = "";
        },
      },
    }
</script>

<style scoped>

</style>
